package chapter8;

import chapter8.MyOuterClass.MyInnerClass;
//method-level inner class
//local class

//additional notes:
//if method is static, local class can only have access to static memebrs
public class MyOuterClass2 {
	private String x = "\"Outer2 string\"";
	
	void doStuff(){
		final String z = "String z is local variable of doStuff.";
		//only modifiers are abstract OR final
		class MyInner2{
			public void seeOuter2(){
				System.out.println("Outer2 x is "+x);
				//This below line will not compile if variable is not final 
				System.out.println("Local variable z is "+z);
				System.out.println("Inner class ref is "+this);
				System.out.println("Outer class ref is "+MyOuterClass2.this);
			}//close of inner class method
		}//close of inner class definition
		MyInner2 mi2 = new MyInner2();
		//This line above must come after the class
		mi2.seeOuter2();
		//Caveat1:The inner class doesn't have access 
		// local variables of the method!
	}
	public static void main(String[] args) {
		MyOuterClass2 moc = new MyOuterClass2();
		moc.doStuff();
	}

}
